<?php
$sql="select * from slideshow order by id desc limit 0,3";
$slideshow_rows=selectAll($sql);

$sql="select * from other";
$other_row=selectOne($sql);

$sql="select * from news_cate";
$cate_rows=selectAll($sql);
$cate_id=isset($_GET['cate_id'])?$_GET['cate_id']:$cate_rows[0]['id']; 
$sql="select * from news_cate where id=$cate_id";
$cate_row=selectOne($sql);

$sql="select * from news where cateid=$cate_id order by id desc limit 0,1";
$r=selectOne($sql);
$news_id=$r['id'];
$id=isset($_GET['id'])?$_GET['id']:$news_id;

if(!$id){show("该分类无内容！",'index.php?m=home&c=news_details&#news_details');die;}
$sql="select * from news where id=$id";
$news_row=selectOne($sql);

$time=explode('-', $news_row['times']);


$sql="select * from news where cateid=$cate_id and id<$id order by id desc limit 0,1";
$last=selectOne($sql);
$sql="select * from news where cateid=$cate_id and id>$id order by id asc limit 0,1";
$next=selectOne($sql);

include './html/home/news_details.html';

?>